//
//  main.m
//  OC6_省市区作业
//
//  Created by dllo on 15/11/2.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {

    
    //    省  市  区
    NSMutableArray *province = [[NSMutableArray alloc] init];
    NSMutableArray *city = nil;
    NSMutableArray *area = nil;
    
    //省 市 字典
    NSMutableDictionary *provinceDictionary = nil;
    NSMutableDictionary *cityDictionary = nil;
    
    for (NSInteger i = 0 ; i < strarr.count; i++) {
        if (![[strarr objectAtIndex:i] hasPrefix:@" "]) {
            provinceDictionary = [NSMutableDictionary dictionary];
            [provinceDictionary setObject:[strarr objectAtIndex:i] forKey:@"provinceName"];
            city = [NSMutableArray array];
            [provinceDictionary setObject:city forKey:@"city"];
            [province addObject:provinceDictionary];
        }
        else if ([[strarr objectAtIndex:i] hasPrefix:@"  "] && ![[strarr objectAtIndex:i] hasPrefix:@"   "]) {
            cityDictionary = [NSMutableDictionary dictionary];
            [cityDictionary setObject:[strarr objectAtIndex:i] forKey:@"cityName"];
            area = [NSMutableArray array];
            [cityDictionary setObject:area forKey:@"area"];
            [city addObject:cityDictionary];
        }
        else {
            [area addObject:[strarr objectAtIndex:i]];
        }
    }
    
    
    return 0;
}
